package com.trkj.dao.jpa;

import java.util.Date;
import java.util.List;

import org.apache.ibatis.annotations.Param;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.CrudRepository;

import com.trkj.pojos.Card;
import com.trkj.pojos.HospPatientRegistration;

public interface J_hosp_patient_registration extends CrudRepository<HospPatientRegistration, String>{
	//找到最大的挂号ID
	@Query(nativeQuery = true,value="select max(substr(patient_registration_id,2)) from hosp_patient_registration")
	public String findMaxId();
	//查询用户当天已挂号次数
	@Query(nativeQuery = true,value="select count(*) from hosp_patient_registration where crad_id=?1 and visit_time> ?2 and visit_time< ?3")
	public int count_reg_times(String card_id,Date start_date,Date end_date);
	
	public int countByCardAndVisitTimeBetween(Card card,Date start_date,Date end_date);
}
